// component/service-button.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    propData: {
      type: Object,
      value: null
    },
    show:{
      type:Boolean,
      value:false
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    xaxis:1000,
    yaxis:300,
  },

  attached() {
    var x = wx.getSystemInfoSync().windowWidth;
    this.setData({
      xaxis: x
    });
    this.onMyEvent();
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onMyEvent(){
      try {
        var agent = wx.getStorageSync('agent')
        if (agent) {
          let isShow = agent.is_use_customer_service;
          if(isShow&&isShow==1){
            this.setData({
              show: true
            });
          }else{
            this.setData({
              show: false
            });
          }
        }
      } catch (e) {
        // Do something when catch error
      }
    },
    //点击客服卡片跳转详情页
    contactHandle(e){
      var path = e.detail.path, query = e.detail.query, params = '';
      if (path) {
          for (var key in query) {
              params += key + '=' + query[key] + '&';
          }
          params = params.slice(0, params.length - 1);
          wx.navigateTo({
              url: path + '?' + params
          })
      }
    }
  }
})
